package model;

import java.io.Serializable;

public class Point2 implements Serializable
{       
        private double x;
        private double y;
        
        public Point2(double x, double y)
        {
                this.x = x;
                this.y = y;
        }
        
        public Point2()
        {
                x = 0;
                y = 0;
        }
        
        public Point2(Point2 p)
        {
                x = p.getX();
                y = p.getY();
        }
        
        public double getX()
        {
                return x;
        }
        
        public double getY()
        {
                return y;
        }
        
        public void setX(double x)
        {
                this.x = x;
        }
        
        public void setY(double y)
        {
                this.y = y;
        }
        
        public double distance(Point2 p)
        {
                return Math.sqrt((x - p.getX())*(x - p.getX()) + (y - p.getY())*(y - p.getY()));
        }
        
        public int distX(Point2 p)
        {
                return Math.abs((int)this.x - (int)p.getX());
        }
        
        public int distY(Point2 p)
        {
                return Math.abs((int)this.y - (int)p.getY());
        }
        
}